home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 44 / PC Actual CD 44.iso / Linux / Cygwin / full.exe / Disk1 / data1.cab / Tools / H-i586-cygwin32 / i586-cygwin32 / include / sys / wait.h < prev   
Encoding:
C/C++ Source or Header  |  1998-12-04  |  1.6 KB  |  64 lines

  1. #ifndef _SYS_WAIT_H
  2. #define _SYS_WAIT_H
  3.  
  4. #include <sys/types.h>
  5. #include <sys/resource.h>
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. #define WNOHANG 1
  12. #define WUNTRACED 2
  13.  
  14. /* A status looks like:
  15.       <2 bytes info> <2 bytes code>
  16.  
  17.       <code> == 0, child has exited, info is the exit value
  18.       <code> == 1..7e, child has exited, info is the signal number.
  19.       <code> == 7f, child has stopped, info was the signal number.
  20.       <code> == 80, there was a core dump.
  21. */
  22.  
  23. #define WIFEXITED(w)    (((w) & 0xff) == 0)
  24. #define WIFSIGNALED(w)    (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
  25. #define WIFSTOPPED(w)    (((w) & 0xff) == 0x7f)
  26. #define WEXITSTATUS(w)    (((w) >> 8) & 0xff)
  27. #define WTERMSIG(w)    ((w) & 0x7f)
  28. #define WSTOPSIG    WEXITSTATUS
  29.  
  30. pid_t wait (int *);
  31. pid_t waitpid (pid_t, int *, int);
  32. pid_t wait3 (int *__status, int __options, struct rusage *__rusage);
  33. pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage);
  34.  
  35. union wait
  36.   {
  37.     int w_status;
  38.     struct
  39.       {
  40.     unsigned int __w_termsig:7; /* Terminating signal.  */
  41.     unsigned int __w_coredump:1; /* Set if dumped core.  */
  42.     unsigned int __w_retcode:8; /* Return code if exited normally.  */
  43.     unsigned int:16;
  44.       } __wait_terminated;
  45.     struct
  46.       {
  47.     unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
  48.     unsigned int __w_stopsig:8; /* Stopping signal.  */
  49.     unsigned int:16;
  50.       } __wait_stopped;
  51.   };
  52.  
  53. #define    w_termsig    __wait_terminated.__w_termsig
  54. #define    w_coredump    __wait_terminated.__w_coredump
  55. #define    w_retcode    __wait_terminated.__w_retcode
  56. #define    w_stopsig    __wait_stopped.__w_stopsig
  57. #define    w_stopval    __wait_stopped.__w_stopval
  58.  
  59. #ifdef __cplusplus
  60. };
  61. #endif
  62.  
  63. #endif
  64.